package com.wwfish.cms.service;

import com.nexustar.gwt.widgets.client.model.PaginationModelDto;
import com.wwfish.cms.model.NewsDto;
import com.wwfish.cms.model.ResourceDto;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: Tom
 * Date: 2010-8-16
 * Time: 14:49:28
 * To change this template use File | Settings | File Templates.
 */
public class NewsManagerImpl implements NewsManager{
    public NewsDto saveAndUpdate(NewsDto dto) {
         System.out.println(dto);
        return dto;
    }

    public void delete(NewsDto dto) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void deleteList(List<NewsDto> dto) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public PaginationModelDto<NewsDto> getPageEntities(Integer begin, Integer count, Map<String, String> conditions) {
       PaginationModelDto md = new PaginationModelDto();
        List r = new ArrayList();
        for (int i = 0; i < count; i++) {
            NewsDto dto = new NewsDto();
            dto.setId(new Long(i));
            dto.setName("资讯" + (i + begin));
            dto.setCreateTime(new Date());
            dto.setBody("aaaaaaaaaaaa");
            int j = (int) (Math.random()* 4)+1;
            dto.setChannelId(new Long(j));
            r.add(dto);
        }
        md.setModelData(r);
        md.setTotalRecord(100);
        return md;
    }
}
